package com.tuling.signalling.streamer.handler;

import com.tuling.signalling.MatchTools;
import com.tuling.signalling.websocket.handler.WebsocketServerHandler;
import io.netty.channel.Channel;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.http.websocketx.TextWebSocketFrame;
public class StreamerHandler  extends WebsocketServerHandler {

    @Override
    public void handlerTextWebSocketFrame(Channel channel, TextWebSocketFrame frame) {

    }
    @Override
    public void channelActive(ChannelHandlerContext ctx) throws Exception {
        Channel channel = ctx.channel();
        String id = channel.id().asLongText();
        MatchTools.addIdleStreamer(id, channel);
    }

    @Override
    public void channelInactive(ChannelHandlerContext ctx) throws Exception {
        Channel channel = ctx.channel();
        String id = channel.id().asLongText();
        MatchTools.delByStreamer(id);
    }
}
